<?php

Route::group([
    'prefix' => 'organize',
    'middleware' => ['api'],
    'as' => 'organize::'
],function (){
    Route::group([
        'namespace' => 'Auth',
        'prefix' => 'auth',
    ], function (){
        Route::post('/login', 'LoginController@login')->name('login');
        Route::post('/forgot/getCode', 'ForgotPasswordController@getCode')->name('forgot.getCode');
        Route::post('/forgot/checkCode', 'ForgotPasswordController@checkCode')->name('forgot.checkCode');
        Route::group([
            'middleware' => 'check.jwt:organize',
        ],function (){
            Route::post('/logout', 'LoginController@logout')->name('logout');
        });
    });

    Route::group([
        'namespace' => 'Leaders',
        'middleware' => ['organize'],
    ],function (){
        /// 权限
        Route::get('/permissions', 'PermissionController@index')->name('permissions.index');
        Route::get('/permissions/import', 'PermissionController@import')->name('permissions.import');

        /// 角色管理
        Route::resource('roles', 'RoleController');

        /// 用户管理
//删除了        Route::get('users/self', 'UserController@showSelf')->name('users.self');
//删除了        Route::get('users/self/permissions', 'UserController@showSelfPermissions')->name('users.selfPermissions');
        Route::resource('leaders', 'LeaderController');

    });


    Route::group([
        'namespace' => 'System',
        'middleware' => ['organize'],
        'prefix' => 'system',
    ],function (){
        /// 菜单管理
        Route::get('menu', 'MenuController@index')->name('menu.index');

        /// 操作日志
        Route::get('/logs', 'LogController@index')->name('logs.index');

        /// 上传文件
        Route::post('/upload/img', 'UploadController@uploadImg')->name('upload.img');

    });
});